xentop: fix abnormal value cpu(%) when domain shutdown.
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Tue, 7 Aug 2007 08:06:38 +0000 (09:06 +0100)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Tue, 7 Aug 2007 08:06:38 +0000 (09:06 +0100)
If we test multiple domain create/shutdown many times.
sometimes abnormal values of cpu(%) are appeared.
This is because shutdown domain remove failure.
(in other words, memory corruption of struct )
This corruption makes abnormal cpu(%) values are shown xentop
sometimes.

Signed-off-by: Atsushi SAKAI <sakaia@jp.fujitsu.com>
tools/xenstat/libxenstat/src/xenstat.c

index a109960c4174cd4a8fd415c9aa1db41c321a2ac4..461806ec7d14746b88d0f71bcb4981b3a9320258 100644 (file)
@@ -677,7 +677,7 @@ static void xenstat_prune_domain(xenstat_node *node, unsigned int entry)
        /* shift entries following specified entry up by one */
        if (entry < node->num_domains) {
                xenstat_domain *domain = &node->domains[entry];
-               memmove(domain,domain+1,node->num_domains-entry);
+               memmove(domain,domain+1,(node->num_domains - entry) * sizeof(xenstat_domain) );
        }
 
        /* zero out original last entry from node -- not